﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;

namespace PlutoStudio.Net.Processors.Attributes
{
    [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
    [MetadataAttribute]
    public class MessageFlagAttribute : ExportAttribute
    {
        // See the attribute guidelines at 
        //  http://go.microsoft.com/fwlink/?LinkId=85236
        readonly byte flag;

        // This is a positional argument
        public MessageFlagAttribute(byte flag)
            :base(typeof(IMessageProcessor))
        {
            this.flag = flag;
        }

        public byte Flag
        {
            get { return flag; }
        }

        public string Catalog { get; set; }

        public override bool Match(object obj)
        {
            var other = obj as MessageFlagAttribute;
            if (other==null)
            {
                return false;
            }
            return flag == other.flag;
        }

    }


}
